#include "NetInit.h"
#include <winsock2.h>

bool NetInit::hasInited = false;

bool NetInit::netLibInit()
{
	if(!hasInited)
	{
		WSADATA wsaData;
		if(0!=WSAStartup(MAKEWORD(2,2),&wsaData))
		{
			return false;
		}
		hasInited=true;
	}
	return true;
}

bool NetInit::netLibRelease()
{
	if(hasInited)
	{
		if(WSACleanup()==0)
		{
			hasInited=false;
			return true;
		}
		else
		{
			return false;
		}
	}
	return true;
}